<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>传智健康</title>
    <meta name="description" content="传智健康">
    <meta name="keywords" content="传智健康">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../plugins/elementui/index.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../css/style.css">

</head>
<body class="hold-transition" style="background-color: #cef2ff">
<div id="app">
    <!--抬头不用修改-->
    <div class="content-header">
        <h1>系统管理<small>密码修改</small></h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>系统管理</el-breadcrumb-item>
            <el-breadcrumb-item>密码修改</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <div style="margin:20px;"></div>
    <el-form style="margin-left: 40%":label-position="labelPosition" label-width="80px" :model="formData">
        <el-form-item label="用户名">
            <el-input style="width: 200px;" v-model="formData.user"></el-input>
        </el-form-item>
        <el-form-item label="旧密码">
            <el-input style="width: 200px" v-model="formData.oldPassword"></el-input>
        </el-form-item>
        <el-form-item label="新密码">
            <el-input  style="width: 200px" v-model="formData.NewPassword"></el-input>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" style="width: 200px" @click="onSubmit">确认修改</el-button>
        </el-form-item>
    </el-form>
</div>
</body>
<!-- 引入组件库 -->
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<script>
    var vue = new Vue({
        el: '#app',
        data:{
            labelPosition: 'right',
            formData: {
                user:'',

            }
        },
        //钩子函数，VUE对象初始化完成后自动执行
        created() {
            this.getUser();
        },
        methods: {

            //提交修改
            onSubmit() {
                // 提交修改请求
                axios.post("/user/updatePassword.do?",this.formData).then(res=>{
                }).catch((error) => {
                    this.showErrorMessage(error);
                });

            },
            // 获取用户名
            getUser:function () {
                axios.get("/user/getUsername.do").then(res=> {
                    this.formData.user = res.data.data.username;
                });


            },

        }
    })
</script>
</html>